import { BTState } from "../BTState";
import { BTDecorator } from "./BTDecorator";

/**
 * [行为树]总是成功节点
 * 子节点返回run时 -> 返回run
 * 否则 -> 返回fail
 */
export class BTAlwaysSucc<T = any> extends BTDecorator<T>{

    process(ctx: T): BTState {
        if (this.child.tick(ctx) === BTState.run) {
            return BTState.run;
        }
        return BTState.succ;
    }

}